﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace Mvc4Learn.Controllers
{
    public class SecurityController : Controller
    {
        //
        // GET: /Security/

        public ActionResult Index()
        {
            return View();
        }

//        [HttpPost]
        [ValidateInput(false)]
        public ActionResult Display(string url, string param)
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            ViewBag.UserName = "未注册";
            if (authCookie != null)
            {
                var authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                ViewBag.UserName = authTicket.Name;
            }
            ViewBag.Url = url;
            ViewBag.Param = param;
            return View();
        }
    }
}
